package com.sqx.modules.task.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.task.entity.TbDailyTasks;
import com.sqx.modules.task.service.TbDailyTasksService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description：TODO
 * @author： qiao
 * @create： 2024/7/22 15:26
 */
@RestController
@RequestMapping("/admin/tbDailyTasks/")
@Api(value = "每日任务-管理端", tags = {"每日任务-管理端"})
public class TbDailyTasksController {

    @Autowired
    private TbDailyTasksService tbDailyTasksService;


    @GetMapping(value = "getTbDailyTasksList")
    @ApiOperation("获取每日任务列表")
    public Result getTbDailyTasksList(@ApiParam("页码")Integer pageNum,
                                      @ApiParam("条数")Integer pageSize,
                                      @ApiParam("每日任务实体")TbDailyTasks tbDailyTasks){
        return tbDailyTasksService.getTbDailyTasksList(pageNum, pageSize, tbDailyTasks);
    }

    @PostMapping(value = "saveOrUpdateTbDailyTasks")
    @ApiOperation("新增或修改每日任务")
    public Result saveOrUpdateTbDailyTasks(@ApiParam("每日任务实体")TbDailyTasks tbDailyTasks){
        return tbDailyTasksService.saveOrUpdateTbDailyTasks(tbDailyTasks);
    }

    @GetMapping(value = "deleteTbDailyTasks")
    @ApiOperation("删除每日任务")
    public Result deleteTbDailyTasks(@ApiParam("每日任务id")Long id){
        return tbDailyTasksService.deleteTbDailyTasks(id);
    }

    @GetMapping(value = "getTbDailyTasksById")
    @ApiOperation("获取每日任务详情")
    public Result getTbDailyTasksById(@ApiParam("每日任务id")Long id){
        return tbDailyTasksService.getTbDailyTasksById(id);
    }


}
